import open3d as o3d
import os

reader = o3d.io.AzureKinectMKVReader()

path = "/share/datasets/hhodataset/azure3/20231020/114/"
reader.open(os.path.join(path, "azure3.mkv"))

idx = 0
#os.makedirs( os.path.join(path, "vis","color"))
#os.makedirs( os.path.join(path, "vis","depth"))
while not reader.is_eof():
    rgbd = reader.next_frame()
    if rgbd is None:
        continue
    color_filename = os.path.join(path, "vis","color", '{:05d}.jpg'.format(idx))
    # depth_filename = os.path.join(path, "vis","depth", '{:05d}.png'.format(idx))
    o3d.io.write_image(color_filename, rgbd.color)
   # # o3d.io.write_image(depth_filename, rgbd.depth)
    idx += 1
    
reader.close()
    
    